
package PDFd.Instance;

import java.util.ArrayList;
import java.util.List;

import PDFd.Layer.Layer;

/**
* <p>Title: PDFdInstance</p>
* <p>Description: An instance of an edited PDF file. 
* This stores everything we need to work with the file at any point ever.</p>
* @author Matt, Tom, Andrew, Kong
* @email matt.mckay@my.uwrf.edu,tom.florin@my.uwrf.edu,
* andrew.kathan@my.uwrf.edu,kong.xiong-1@my.uwrf.edu
* @date December 1st,2011*/

public class PDFdInstance
{
	public String UUID;
	public String pathToOriginalPDF;
	public String displayName;
	public List<Layer> layers;
	public byte[] renderedAsPNG;
	public PDFdInstance() {
		layers = new ArrayList<Layer>();
	}

	/**
	 * Adds a layer, returns the index of the layer.
	 * @param l The layer to add
	 * @return
	 */
	public int addLayer(Layer l) {
		Integer index = layers.size();
		addLayer(l,index);
		return index;
	}
	/**
	 * Adds a layer at a specified index
	 * @param l The Layer
	 * @param index The index to place it at
	 */
	public void addLayer(Layer l, Integer index) {
		layers.add(index, l);
	}
	/**
	 * Gets a list of all layers. Handy if you want to apply a transform to all of them
	 * @return
	 */
	public List<Layer> getLayers() {
		return layers;
	}
	
	/**
	 * Returns the layer
	 * @param index
	 * @return
	 */
	public Layer getLayer(Integer index) {
		return layers.get(index);
	}
/**
 * This method returns the image as a PNG
 * @return
 */
	public byte[] getRenderedAsPNG() {
		return this.renderedAsPNG;
	}
	
/**
 * This method sets an image as a PNG
 * @param renderedAsPNG
 */
	public void setRenderedAsPNG(byte[] renderedAsPNG) {
		this.renderedAsPNG = renderedAsPNG;
	}
/**
 * This method gets the unique user id
 * @return UUID
 */
	public String getUUID() {
		return this.UUID;
	}
/**
 * This method sets the unique user id
 * @param uUID
 */
	public void setUUID(String uUID) {
		this.UUID = uUID;
	}
/**
 * This method sets the path to the orignal pdf
 * @return
 */
	public String getPathToOriginalPDF() {
		return this.pathToOriginalPDF;
	}
/**
 * This method setsthe path to the orignal pdf with variables
 * @param pathToOriginalPDF
 */
	public void setPathToOriginalPDF(String pathToOriginalPDF) {
		this.pathToOriginalPDF = pathToOriginalPDF;
	}
/**
 * This method gets the display name
 * @return
 */
	public String getDisplayName() {
		return this.displayName;
	}
/**
 * This mehthod sets the display name.
 * @param displayName
 */
	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}
}